#pragma once

#ifndef XTKDEV_STRUCT_H
#define XTKDEV_STRUCT_H

//==============================================================================
//== XIC Tool Kit Struct
//==============================================================================
		
struct XtkDev
{
	//general info	
	char			ScannerManufacturer	[XTK_MAX_STRLEN];
	char			SofwareVersion		[XTK_MAX_STRLEN];
	char			ScannerModel		[XTK_MAX_STRLEN];
	

	//data acquisition interface
	unsigned char	intf_unit;
	char			intf_cfg			[XTK_MAX_STRLEN];
	char			intf_dll			[XTK_MAX_STRLEN];
	char			intf_path			[XTK_MAX_STRLEN];
	void			*intf_p;

	
	//xic configuration file
	char			xcf_file_name		[XTK_MAX_STRLEN];
	char			xcf_ver				[XTK_MAX_STRLEN];


	//message buffer used for storing error messages
	char			message				[XTK_MAX_STRLEN];


	//timing
	unsigned long	crystal_clk;
	float			pixel_clk;
	unsigned long 	timeout;


	//register values
	unsigned char	fpga_addr;

	unsigned char	rst_time_man;
	unsigned char	rst_time_exp;
	unsigned char	int_time_man;
	unsigned char	int_time_exp;

	unsigned char	rden_delay_man;
	unsigned char	rden_delay_exp;
	unsigned char	rden_pulse_man;
	unsigned char	rden_pulse_exp;
		
	unsigned char	posenc;
	unsigned char	clk_div;
	unsigned char	m0, m1, m2;
	unsigned char	gp_reg;

	unsigned char	adc_reg1;
	unsigned char	adc_reg2;
	unsigned char	adc_reg3;
	unsigned char	dac_rgb;
	unsigned char	pga_rgb;	
	
	
	//camera parameters
	unsigned short	pixels_per_module;
	unsigned short	pixels_per_module_hires;
	unsigned short	pixels_per_module_lores;
	unsigned short	pixels_per_array;
	float			resolution;
	float			resolution_hi;
	float			resolution_lo;

	unsigned char	*RawData;
	unsigned short 	lines_per_frame;
	unsigned short	frame_fifo_pos;

	unsigned short	bytes_offset;
	unsigned short  ti_bytes_offset;
	unsigned short	td_bytes_offset;
	unsigned char	bytes_per_adc_write;
	unsigned long	adc_writes_per_line;
	unsigned long	bytes_per_line;
	unsigned long	bytes_per_adc_smp;
	
	unsigned char	num_adcs;
	unsigned char	*adc_addr;
	unsigned char	*adc_bytes_shift;
	unsigned short	*channel_bytes_shift;
	unsigned char	*modules_per_channel;
	unsigned short	modules_per_array;
	unsigned long	*module_jump;
};


#endif